// Sets FStatusCode. Any code but IMS_OK causes FFailed to be set to True
procedure SetStatusCode(iCode: Integer);
// Processes an IFD at given offset. bMotorola denotes whether Motorola byte-order is used.
// Returns offset to the next IFD, if there's any, else 0
function ProcessIFD(const sData: String; iOffset: Integer; bMotorola: Boolean): Integer;
public
constructor Create(const sFileName: String);
destructor Destroy; override;
// Props
property EXIFData: TStrings read FEXIFData;
// -- One of the IMS_xxx constants, see below. Can use metadata only if StatusCode = IMS_OK
property StatusCode: Integer read FStatusCode;
end;
// An IFD entry
PIFDEntry = ^TIFDEntry;
TIFDEntry = packed record
wTag: Word; // Tag ID
wFmt: Word; // Format (datatype) code
iCompCnt: Integer; // Component count
iData: Integer; // Data or offset to data (if data length>4)
end;
// The type of EXIF tag value
TEXIFTagValueType = (
xtvtRegular, // Regular value: numbers are numbers, characters are characters etc.
xtvtUserComment, // Used for UserComment ($9286): first 8 bytes specify the charset, the next are character codes, whether one- or two-byte (depending on charset)
xtvtCharVersion, // Data are character codes, each char is separated with a period so they're version number
xtvtUnicode, // Data are double-byte Unicode chars
xtvtBinary); // Data are raw binary bytes
// An EXIF tag
PEXIFTag = ^TEXIFTag;
TEXIFTag = record
iTag: Integer; // Image's EXIF tag ID
VType: TEXIFTagValueType; // Value type
sName: AnsiString; // Tag name
sVList: AnsiString; // Value list in the format: 'value1=name1:value2=name2:...'
sDesc: AnsiString; // Tag description
end;
const
// Metadata discrepancies/errors
IMS_OK = 0000; // Metadata successfully parsed
IMS_CannotOpenFile = 0001; // Unable to open file (file doesn't exist, access denied etc)
IMS_ReadFailure = 0002; // Unable to read from file (EOF encountered, media error, access denied etc)
IMS_NotAJPEGFile = 0010; // The file doesn't appear to be a JPEG file
IMS_NoMetadata = 0011; // No metadata encountered in the file
IMS_InvalidEXIFHeader = 0100; // EXIF header doesn't match